<!DOCTYPE html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="hexo博客,">










<meta name="description" content="HEXO配置 安装hexo 1npm i hexo -g  创建heox博客 123hexo init &amp;lt;blog name&amp;gt;cd &amp;lt;blog name&amp;gt;npm i  装完依赖后执行hexo server即可本地预览了   添加文章1hexo new hexo建站记录  添加文章分类1hexo new page categories  此时，在/source/categor">
<meta name="keywords" content="hexo博客">
<meta property="og:type" content="article">
<meta property="og:title" content="hexo建站记录">
<meta property="og:url" content="https://straybirds.top/2019/09/11/hexo建站记录/index.html">
<meta property="og:site_name" content="StrayBirds">
<meta property="og:description" content="HEXO配置 安装hexo 1npm i hexo -g  创建heox博客 123hexo init &amp;lt;blog name&amp;gt;cd &amp;lt;blog name&amp;gt;npm i  装完依赖后执行hexo server即可本地预览了   添加文章1hexo new hexo建站记录  添加文章分类1hexo new page categories  此时，在/source/categor">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://straybirds.top/uploads/2019/09/dns-cname.png">
<meta property="og:image" content="https://straybirds.top/uploads/2019/09/dns-a.png">
<meta property="og:image" content="https://straybirds.top/uploads/2019/09/leancloud-class.png">
<meta property="og:image" content="https://straybirds.top/uploads/2019/09/leancloud-web-security.png">
<meta property="og:image" content="https://straybirds.top/uploads/2019/09/leancloud-appid.png">
<meta property="og:updated_time" content="2019-09-23T08:56:44.861Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="hexo建站记录">
<meta name="twitter:description" content="HEXO配置 安装hexo 1npm i hexo -g  创建heox博客 123hexo init &amp;lt;blog name&amp;gt;cd &amp;lt;blog name&amp;gt;npm i  装完依赖后执行hexo server即可本地预览了   添加文章1hexo new hexo建站记录  添加文章分类1hexo new page categories  此时，在/source/categor">
<meta name="twitter:image" content="https://straybirds.top/uploads/2019/09/dns-cname.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://straybirds.top/2019/09/11/hexo建站记录/">





  <title>hexo建站记录 | StrayBirds</title>
  





  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?1c055ff4eb7f9e86cf845aeff86f38d5";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">StrayBirds</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://straybirds.top/2019/09/11/hexo建站记录/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="stray_brid_">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/uploads/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="StrayBirds">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">hexo建站记录</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2019-09-11T20:56:38+08:00">
                2019-09-11
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/hexo博客/" itemprop="url" rel="index">
                    <span itemprop="name">hexo博客</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/2019/09/11/hexo建站记录/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count valine-comment-count" data-xid="/2019/09/11/hexo建站记录/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          
             <span id="/2019/09/11/hexo建站记录/" class="leancloud_visitors" data-flag-title="hexo建站记录">
               <span class="post-meta-divider">|</span>
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>
               
                 <span class="post-meta-item-text">阅读次数&#58;</span>
               
                 <span class="leancloud-visitors-count"></span>
             </span>
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="HEXO配置"><a href="#HEXO配置" class="headerlink" title="HEXO配置"></a>HEXO配置</h2><ul>
<li><p>安装hexo</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm i hexo -g</span><br></pre></td></tr></table></figure>
</li>
<li><p>创建heox博客</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">hexo init &lt;blog name&gt;</span><br><span class="line"><span class="built_in">cd</span> &lt;blog name&gt;</span><br><span class="line">npm i</span><br></pre></td></tr></table></figure>
</li>
<li><p>装完依赖后执行<code>hexo server</code>即可本地预览了</p>
</li>
</ul>
<h4 id="添加文章"><a href="#添加文章" class="headerlink" title="添加文章"></a>添加文章</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo new hexo建站记录</span><br></pre></td></tr></table></figure>

<h4 id="添加文章分类"><a href="#添加文章分类" class="headerlink" title="添加文章分类"></a>添加文章分类</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo new page categories</span><br></pre></td></tr></table></figure>

<p>此时，在<code>/source/categories/index.md</code>中修改type为 <code>categories</code>，然后就可以在文章中添加分类了：<br> <figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: hexo建站记录</span><br><span class="line">date: 2019-09-11 20:56:38</span><br><span class="line">categories: hexo博客</span><br><span class="line">tags: </span><br><span class="line"><span class="bullet"> - </span>hexo博客</span><br><span class="line"><span class="bullet"> - </span>hexo</span><br><span class="line">---</span><br></pre></td></tr></table></figure></p>
<h4 id="添加文章标签"><a href="#添加文章标签" class="headerlink" title="添加文章标签"></a>添加文章标签</h4><p>步骤与添加分类几乎一样:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo new page tags</span><br></pre></td></tr></table></figure>

<p>此时，在<code>/source/tags/index.md</code>中修改type为 <code>tags</code>，然后就可以在文章中添加标签了：</p>
 <figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: hexo建站记录</span><br><span class="line">date: 2019-09-11 20:56:38</span><br><span class="line">tags: </span><br><span class="line"><span class="bullet"> - </span>hexo博客</span><br><span class="line"><span class="bullet"> - </span>hexo</span><br><span class="line">---</span><br></pre></td></tr></table></figure>

<h4 id="自动部署"><a href="#自动部署" class="headerlink" title="自动部署"></a>自动部署</h4><p>需要先安装依赖包：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-deployer-git --save</span><br></pre></td></tr></table></figure>

<p><code>/_config.yml</code></p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">deploy:</span></span><br><span class="line"><span class="attr">  type:</span> <span class="string">git</span></span><br><span class="line"><span class="attr">  repo:</span> <span class="string">git@github.com:username/username.github.io.git</span></span><br><span class="line"><span class="attr">  branch:</span> <span class="string">master</span></span><br></pre></td></tr></table></figure>

<h4 id="安装hexo主题："><a href="#安装hexo主题：" class="headerlink" title="安装hexo主题："></a>安装hexo主题：</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">clone</span> https://github.com/theme-next/hexo-theme-next themes/next</span><br></pre></td></tr></table></figure>

<p>在<code>_config.yml</code>中修改配置</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">theme:</span> <span class="string">next</span></span><br></pre></td></tr></table></figure>

<h4 id="自定义域名"><a href="#自定义域名" class="headerlink" title="自定义域名"></a>自定义域名</h4><ul>
<li>在<code>username.github.io</code>仓库的设置中，设置<code>Custom domain</code></li>
<li>在<code>username.github.io</code>仓库中新建一个CNAME文件，文件内容是你的域名<blockquote>
<p>为避免每次更新都需要重复创建文件，可以安装npm包<code>npm i hexo-generator-cname -S</code></p>
</blockquote>
</li>
<li>在DNS解析服务器上，配置解析规则，如下图所示：<br> <img src="/uploads/2019/09/dns-cname.png" alt="CNAME" title="记录类型：CNAME"><br> <img src="/uploads/2019/09/dns-a.png" alt="A" title="记录类型：A "><br>  IP需要手动<code>ping github.io</code>查看</li>
</ul>
<h2 id="Next主题配置"><a href="#Next主题配置" class="headerlink" title="Next主题配置"></a>Next主题配置</h2><h4 id="配置文章观看次数"><a href="#配置文章观看次数" class="headerlink" title="配置文章观看次数"></a>配置文章观看次数</h4><ul>
<li>注册<a href="https://leancloud.cn" target="_blank" rel="noopener">leancloud</a>, 并新建应用</li>
<li>新建Class: Counter<br><img src="/uploads/2019/09/leancloud-class.png" alt="新建好的Counter Class"></li>
<li>在 设置 -&gt; 安全中心中，设置安全域名。设置后，只有安全域名可以发送请求。<br><img src="/uploads/2019/09/leancloud-web-security.png" alt="设置安全域名"> </li>
<li>在 设置 -&gt; 应用 Key 中找到appid和appkey， 并在next的 <code>_config.yml</code>中配置<br><img src="/uploads/2019/09/leancloud-appid.png" alt="应用 Key"> <figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">valine:</span></span><br><span class="line"><span class="attr">  enable:</span> <span class="literal">true</span></span><br><span class="line"><span class="attr">  appid:</span>  <span class="string">your</span> <span class="string">leancloud</span> <span class="string">appid</span></span><br><span class="line"><span class="attr">  appkey:</span>  <span class="string">your</span> <span class="string">leancloud</span> <span class="string">appkey</span></span><br></pre></td></tr></table></figure>

</li>
</ul>
<h4 id="配置valine"><a href="#配置valine" class="headerlink" title="配置valine"></a>配置valine</h4><p>在next的 <code>_config.yml</code>中同样配置leancloud的appid和appkey：</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">leancloud_visitors:</span></span><br><span class="line"><span class="attr">  enable:</span> <span class="literal">true</span></span><br><span class="line"><span class="attr">  app_id:</span> <span class="string">your</span> <span class="string">leancloud</span> <span class="string">appid</span></span><br><span class="line"><span class="attr">  app_key:</span> <span class="string">your</span> <span class="string">leancloud</span> <span class="string">appkey</span></span><br></pre></td></tr></table></figure>

<h4 id="配置valine-CDN"><a href="#配置valine-CDN" class="headerlink" title="配置valine CDN"></a>配置valine CDN</h4><p>网上查询到的在next的_config.yml中配置cdn的方式已经过时，采用直接在 <code>/themes/next/layout/_third-party/comments/valine.swig</code>中替换引用js的地址的方法：</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">https://cdn.jsdelivr.net/npm/valine@1.3.4/dist/Valine.min.js</span><br></pre></td></tr></table></figure>


      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/hexo博客/" rel="tag"># hexo博客</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2019/09/09/了解call-bind-apply/" rel="next" title="了解call/apply/bind">
                <i class="fa fa-chevron-left"></i> 了解call/apply/bind
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2019/09/23/了解mapbox表达式/" rel="prev" title="认识mapbox表达式（expression）">
                认识mapbox表达式（expression） <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
    </div>
  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/uploads/avatar.jpg" alt="stray_brid_">
            
              <p class="site-author-name" itemprop="name">stray_brid_</p>
              <p class="site-description motion-element" itemprop="description">What is an ocean, but mutiple of drops.</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">12</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">3</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">7</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#HEXO配置"><span class="nav-number">1.</span> <span class="nav-text">HEXO配置</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#添加文章"><span class="nav-number">1.0.1.</span> <span class="nav-text">添加文章</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#添加文章分类"><span class="nav-number">1.0.2.</span> <span class="nav-text">添加文章分类</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#添加文章标签"><span class="nav-number">1.0.3.</span> <span class="nav-text">添加文章标签</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#自动部署"><span class="nav-number">1.0.4.</span> <span class="nav-text">自动部署</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#安装hexo主题："><span class="nav-number">1.0.5.</span> <span class="nav-text">安装hexo主题：</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#自定义域名"><span class="nav-number">1.0.6.</span> <span class="nav-text">自定义域名</span></a></li></ol></li></ol><li class="nav-item nav-level-2"><a class="nav-link" href="#Next主题配置"><span class="nav-number">2.</span> <span class="nav-text">Next主题配置</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#配置文章观看次数"><span class="nav-number">2.0.1.</span> <span class="nav-text">配置文章观看次数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#配置valine"><span class="nav-number">2.0.2.</span> <span class="nav-text">配置valine</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#配置valine-CDN"><span class="nav-number">2.0.3.</span> <span class="nav-text">配置valine CDN</span></a></li></ol></li></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">stray_brid_</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Pisces</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  










  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/valine@1.3.4/dist/Valine.min.js"></script>
  
  <script type="text/javascript">
    var GUEST = ['nick','mail','link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item=>{
      return GUEST.indexOf(item)>-1;
    });
    new Valine({
        el: '#comments' ,
        verify: true,
        notify: false,
        appId: '8g39VF5cW0SljcelPGGyN4jm-gzGzoHsz',
        appKey: 'pKPp2FxqhUAUBIPsRabgUW5M',
        placeholder: 'Just go go',
        avatar:'robohash',
        guest_info:guest,
        pageSize:'10' || 10,
    });
  </script>



  





  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script>
  <script>AV.initialize("8g39VF5cW0SljcelPGGyN4jm-gzGzoHsz", "pKPp2FxqhUAUBIPsRabgUW5M");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  
  

  

  

  

</body>
</html>
